using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SqlTools.CodeGenerator.Data;

namespace SqlTools.CodeGenerator.UI.Controls
{
	public partial class IntrinsicTablePropertyEditor : UserControl
	{
		protected TableProperty _property = null;

		public IntrinsicTablePropertyEditor()
		{
			InitializeComponent();
		}

		public TableProperty Property
		{
			get { return _property; }
			set 
			{ 
				_property = value;

				if ( _property != null )
				{
					txtPropertyName.Text = _property.PropertyName;
					txtFieldName.Text = _property.FieldName;
					txtDefaultValue.Text = _property.DefaultValue;
				}
			}
		}

		private void txtPropertyName_TextChanged(object sender, EventArgs e)
		{
			if ( _property != null )
				_property.PropertyName = txtPropertyName.Text;
		}

		private void txtFieldName_TextChanged(object sender, EventArgs e)
		{
			if ( _property != null )
				_property.FieldName = txtFieldName.Text;
		}

		private void txtDefaultValue_TextChanged(object sender, EventArgs e)
		{
			if ( _property != null )
				_property.DefaultValue = txtDefaultValue.Text;
		}


	}
}
